<form name="custome" enctype="multipart/form-data">
	<input type="hidden" name="pid" value="{$project_id}">
	<div class="card_cont">
		<div class="card_list">
			<span class="asterisk">*</span><input class="required-text" type="text" name="company_name" value="" placeholder="文件名称">
			<p class="error-item">必填项</p>
		</div>
		<div class="card_list">
				<!-- <input id="inp" type='file' accept=".jpg" class="db wh pat z5 op0"> -->
			附件<input name="file" type="file" accept="image/*" >
		</div>
		<button type="button" class="sub_btn card_sub">提交</button>
	</div>
</form>
<script src="__PUBLIC__/mobile/js/mobiscroll.min.js"></script>
<script>
    $(function(){
	<!-- function EL(id) { return document.getElementById(id); } -->
	<!-- function readFile() { -->
		<!-- if (this.files && this.files[0]) { -->
			<!-- var FR= new FileReader(); -->
			<!-- FR.onload = function(e) { -->
				<!-- var _baseurl = e.target.result; -->
				<!-- console.log(e.target); -->
				<!-- console.log(e.target.result); -->

			<!-- }; -->
			<!-- FR.readAsDataURL( this.files[0] ); -->
		<!-- } -->
	<!-- } -->
	<!-- EL("inp").addEventListener("change", readFile, false); -->
	
        $('.radio').click(function(){
            $(this).addClass('active').siblings().removeClass('active');
        })
        $('.card_fix .back_btn').click(function(){
            $('.card_fix').fadeOut().find('.modal_body').html('');
            $('html').removeClass('active')
        })
        $('.card_list label').click(function(){
            submit();
        })
		
        //提交
        function submit(){
            var tag = true;
            $(".required-text").each(function(){
                var $val = $(this).val();
                if($val=="" || /^\s+$/.test($val)){
                    tag = false;
                }
            });

            if(tag){
                $('.card_sub').removeClass('disabled').attr('disabled',false);
            }else{
                $('.card_sub').addClass('disabled').attr('disabled',true);
            }
        }
		$('.card_sub').click(function(){
            $.ajax({
                type:"POST",
                async:false,
                dataType:"json",
                data:$("[name='custome']").serialize()+"&action=add",
                url:"__APP__/Mobile/Crm/project_file_doadd",
                success:function(data){
                    if(data.status){
                        $('.card_fix').fadeOut().find('.modal_body').html('');
                        success_pop(data.status,data.msg,1,'__APP__/Mobile/Crm/project_contact/id/{$project_id}');
                    }else{
                        modal_alert(data.msg);
                    }
                }
            });
        })
    })
</script>
</body>
</html>